//
//  NSData+Encryption.h
//  CheFu365
//
//  Created by safiri on 2017/8/31.
//  Copyright © 2017年 safiri. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSData (ZSEncryption)

- (NSData *)AES128EncryptWithKey:(NSString *)key gIv:(NSString *)Iv;
- (NSData *)AES128DecryptWithKey:(NSString *)key gIv:(NSString *)Iv;

- (NSData *)DESEncryptWithKey:(NSString *)key gIv:(NSString *)Iv;
- (NSData *)DESDecryptWithKey:(NSString *)key gIv:(NSString *)Iv;

- (NSData *)DES3EncryptWithKey:(NSString *)key gIv:(NSString *)Iv;
- (NSData *)DES3DecryptWithKey:(NSString *)key gIv:(NSString *)Iv;

#pragma mark - hash
- (NSString *)md2String;
- (NSData *)md2Data;

- (NSString *)md4String;
- (NSData *)md4Data;


- (NSString *)md5String;
- (NSData *)md5Data;


- (NSString *)sha1String;
- (NSData *)sha1Data;

- (NSString *)sha224String;
- (NSData *)sha224Data;


- (NSString *)sha256String;
- (NSData *)sha256Data;

- (NSString *)sha384String;
- (NSData *)sha384Data;

- (NSString *)sha512String;
- (NSData *)sha512Data;

//hmac:
- (NSString *)hmacMD5StringWithKey:(NSString *)key;
- (NSData *)hmacMD5DataWithKey:(NSData *)key;

- (NSString *)hmacSHA1StringWithKey:(NSString *)key;
- (NSData *)hmacSHA1DataWithKey:(NSData *)key;

- (NSString *)hmacSHA224StringWithKey:(NSString *)key;
- (NSData *)hmacSHA224DataWithKey:(NSData *)key;

- (NSString *)hmacSHA256StringWithKey:(NSString *)key;
- (NSData *)hmacSHA256DataWithKey:(NSData *)key;

- (NSString *)hmacSHA384StringWithKey:(NSString *)key;
- (NSData *)hmacSHA384DataWithKey:(NSData *)key;

- (NSString *)hmacSHA512StringWithKey:(NSString *)key;
- (NSData *)hmacSHA512DataWithKey:(NSData *)key;

/**
 Returns a lowercase NSString for crc32 hash.
 */
- (NSString *)crc32String;
/**
 Returns crc32 hash.
 */
- (uint32_t)crc32;


@end
